
namespace Core {
    export class BaseProxy {
        private _controller: BaseController;
        public constructor(controller: BaseController) {
            this._controller = controller;
        }

        public applyFunc(key: any, ...param: any[]): any {
            return this._controller.applyFunc.apply(this._controller, arguments);
        }

        public applyControllerFunc(controllerKey: number, key: any, ...param: any[]): any {
            return this._controller.applyControllerFunc.apply(this._controller, arguments);
        }

        public receiveServerMsg(key: any, callbackFunc: Function, callbackObj: any): void {
            //App.MessageCenter.addListener(key, callbackFunc, callbackObj);
        }
        public removeServerMsg(key: any, callbackFunc: Function, callbackObj: any): void {
            //App.MessageCenter.removeListener(key, callbackFunc, callbackObj);
        }

        public receiveServerMsgOnce(key: any, callbackFunc: Function, callbackObj: any): void {
            var callback: Function = function (param: any): void {
                this.removeServerMsg(key, callback, this);
                callbackFunc.apply(callbackObj, param);
            }
            this.receiveServerMsg(key, callback, this);
        }

        public sendSocketMsg(msg: any): void {
            //App.Socket.send(msg);
        }

    }
}